package com.nw.dsl4j.generator.model;

import java.lang.reflect.Modifier;


public class AntlrRule {
	String name;
	Class<?> returns;
	String pattern;
	boolean isAbstract = false;
	
	public boolean isAbstract() {
		return returns.isInterface() || Modifier.isAbstract(returns.getModifiers());
	}
	public void setAbstract(boolean isAbstract) {
		this.isAbstract = isAbstract;
	}
	public void setPattern(String pattern) {
		this.pattern = pattern;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Class<?> getReturns() {
		return returns;
	}
	public void setReturns(Class<?> returns) {
		this.returns = returns;
	}
	@Override
	public String toString() {
		return name + 
			(returns == null? "" : " returns [" + returns.getCanonicalName() +"]") + 
			":\n\t" + 
			pattern + ";\n";
	}
	public String getPattern() {
		return pattern;
	}
	
}
